package com.osilon.updater.tasks;

import java.util.List;


import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodNode;

import com.osilon.asm.InsnSearcher;
import com.osilon.asm.OsilonClassNode;
import com.osilon.util.ClassCache;

public class SearchTask extends Task {
	@Override
	public boolean canProcess(OsilonClassNode node) {
		return true;
	}

	@Override
	public void process(ClassCache cache, OsilonClassNode node) {
		for(MethodNode mn : (List<MethodNode>) node.methods) {
			InsnSearcher searcher = new InsnSearcher(mn);
			
			LdcInsnNode ldc = null;
			Object o = "h";
			
			while((ldc = searcher.nextLdc(o)) != null) {
				System.out.println(node.name + "." + mn.name + " " + mn.desc);
			}
		}
	}
}
